package com.cust.cow.controller;

import com.cust.cow.common.BullCollectSemenLog;
import com.cust.cow.common.Result;
import com.cust.cow.pojo.bullCattle;
import com.cust.cow.service.BullCattleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/bullCattle")
@CrossOrigin("*")
public class BullCattleController {
    @Autowired
    BullCattleService bullCattleService;

    @RequestMapping("findBullCattleAll")
    public List<bullCattle> findBullCattleAll(){
        return bullCattleService.findBullCattleAll();
    }

    @PostMapping("insertBullCattle")
    public Result insertBullCattle(@RequestBody bullCattle bullCattle){
        return bullCattleService.insertBullCattle(bullCattle);
    }

    @GetMapping("deleteBullCattle")
    public Result deleteBullCattle(@RequestParam("cattleId") Integer cattleId){
        return bullCattleService.deleteBullCattle(cattleId);
    }

    @GetMapping("findBullCattleCsById")
    public BullCollectSemenLog findBullCattleCsById(@RequestParam("cattleId") Integer cattleId){
        return bullCattleService.findBullCattleById(cattleId);
    }

    @RequestMapping("findBullCattleCs")
    public List<BullCollectSemenLog> findBullCattleCs(){
        return bullCattleService.findBullCattleCs();
    }
}
